home *** CD-ROM | disk | FTP | other *** search
- //----------------------------------------------------------------------------
- // MINE DYNAMIC DATA
-
- MineData AntipersonelMine
- {
- className = "Mine";
- description = "Antipersonel Mine";
- shapeFile = "mine";
- shadowDetailMask = 4;
- explosionId = mineExp;
- explosionRadius = 10.0;
- damageValue = 0.65;
- damageType = $MineDamageType;
- kickBackStrength = 150;
- triggerRadius = 2.5;
- maxDamage = 0.5;
- shadowDetailMask = 0;
- destroyDamage = 1.0;
- damageLevel = {1.0, 1.0};
- };
-
- function AntipersonelMine::onAdd(%this)
- {
- %this.damage = 0;
- AntipersonelMine::deployCheck(%this);
- }
-
- function AntipersonelMine::onCollision(%this,%object)
- {
- %type = getObjectType(%object);
- %data = GameBase::getDataName(%this);
- if ((%type == "Player" || %data == AntipersonelMine || %data == Vehicle || %type == "Moveable") &&
- GameBase::isActive(%this))
- GameBase::setDamageLevel(%this, %data.maxDamage);
- }
-
- function AntipersonelMine::deployCheck(%this)
- {
- if (GameBase::isAtRest(%this)) {
- GameBase::playSequence(%this,1,"deploy");
- GameBase::setActive(%this,true);
- %set = newObject("set",SimSet);
- if(1 != containerBoxFillSet(%set,$MineObjectType,GameBase::getPosition(%this),1,1,1,0)) {
- %data = GameBase::getDataName(%this);
- GameBase::setDamageLevel(%this, %data.maxDamage);
- }
- deleteObject(%set);
- }
- else
- schedule("AntipersonelMine::deployCheck(" @ %this @ ");", 3, %this);
- }
-
- function AntipersonelMine::onDestroyed(%this)
- {
- $TeamItemCount[GameBase::getTeam(%this) @ "mineammo"]--;
- }
-
- function AntipersonelMine::onDamage(%this,%type,%value,%pos,%vec,%mom,%object)
- {
- if (%type == $MineDamageType)
- %value = %value * 0.25;
-
- %data = GameBase::getDataName(%this);
- if((%data.maxDamage/1.5) < %this.damage+%value)
- GameBase::setDamageLevel(%this, %data.maxDamage);
- else
- %this.damage += %value;
- }
-
- //----------------------------------------------------------------------------
-
- MineData Handgrenade
- {
- mass = 0.3;
- drag = 1.0;
- density = 2.0;
- elasticity = 0.15;
- friction = 1.0;
- className = "Handgrenade";
- description = "Handgrenade";
- shapeFile = "grenade";
- shadowDetailMask = 4;
- explosionId = grenadeExp;
- explosionRadius = 10.0;
- damageValue = 0.5;
- damageType = $ShrapnelDamageType;
- kickBackStrength = 100;
- triggerRadius = 0.5;
- maxDamage = 2;
- };
-
- function Handgrenade::onAdd(%this)
- {
- %data = GameBase::getDataName(%this);
- schedule("Mine::Detonate(" @ %this @ ");",2.0,%this);
- }
-
- function Mine::onDamage(%this,%type,%value,%pos,%vec,%mom,%object)
- {
- if (%type == $MineDamageType)
- %value = %value * 0.25;
-
- %damageLevel = GameBase::getDamageLevel(%this);
- GameBase::setDamageLevel(%this,%damageLevel + %value);
- }
-
- function Mine::Detonate(%this)
- {
- %data = GameBase::getDataName(%this);
- GameBase::setDamageLevel(%this, %data.maxDamage);
- }
-
-